const express = require("express");
const fs = require('fs');
const app = express();
const history = require('connect-history-api-fallback');
app.use(history());
app.use(express.static('../dist'));
app.get('/', (req, res) => {
  fs.readFile('../dist/index.html', 'utf-8', (err, content) => {
    if (err) {
      console.log('We cannot open "index.html" file.')
    }
    res.writeHead(200, {
      'Content-Type': 'text/html; charset=utf-8'
    })
    res.end(content)
  })
});
console.log('start: http://localhost:3000')
app.listen(3000);